package com.example.SOPVersionChain.controller;

import com.example.SOPVersionChain.model.FileInfo;
import com.example.SOPVersionChain.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/versions")
public class VersionApiController {

    private final FileService fileService;

    @Autowired
    public VersionApiController(FileService fileService) {
        this.fileService = fileService;
    }

    /**
     * 获取所有文件列表
     * @return 文件列表
     */
    @GetMapping
    public List<FileInfo> getAllFiles() {
        return fileService.getAllFiles();
    }
} 